package com.donguk.file.service;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.donguk.file.dao.TestDbDao;
import com.donguk.file.dto.Sample;

public class SampleServiceImpl implements SamapleService {
	
	private Log log = LogFactory.getLog(this.getClass());
	
	@Autowired
	private TestDbDao testDbBao;
	
	private static Map<Long, Sample> samples;
	static {
		samples = new HashMap<Long, Sample>();
		Sample txt = new Sample(1, "hello", "okok@donguk.com");
		samples.put(txt.getId(), txt);
	}
	
	@Override
	public void add(Sample txt) {
		samples.put(txt.getId(), txt);
	}

	/**
	 * my sql db test
	 */
	@Override
	public void testdb() {
		log.info("아놔.. 젠장.");
		try{
			testDbBao.insertTest();
		} catch(Exception e){
			e.printStackTrace();
			log.error(e);
		}
	}

}
